package com.verify.util;

import java.util.HashMap;

/**
 * Rest返回数据对象
 *
 * @author yansiyang
 * @version V1.0
 * @date 2019/4/2 15:30
 */
public class R extends HashMap<String, Object> {
    private static final long serialVersionUID = 1L;

    /**
     * 状态码描述
     * 参考 类com.csicit.ace.common.constant.HttpCode
     */

    private R(int code, String msg) {
        put("code", code);
        put("msg", msg);
    }

    public static R ok() {
        return new R(200, "success");
    }

    public static R error(String msg) {
        return new R(500, msg);
    }

    public R put(String key, Object msg) {
        super.put(key, msg);
        return this;
    }
}
